import { IsNotEmpty, Length, IsString, IsNumber, Min, Max, IsArray, ArrayMinSize, ArrayMaxSize, IsOptional, MaxLength } from 'class-validator';
import PaginationDto from 'src/dto/pagination.dto';

class Common {
    @Length(1, 10, {message : '名称限制在1至10个字符之间'})
    @IsString()
    name:string;

    @Length(1, 20, {message : '编号限制在1至20个字符之间'})
    @IsString()
    code:string;
}


export class AddDto extends Common {
    @IsNumber()
    @IsNotEmpty()
    @IsOptional()
    parentId:number;

    @IsNumber()
    @IsNotEmpty()
    categoryId:number;
}

export class EditDto extends Common {
    
}


export default class ListDto extends PaginationDto {
    @IsString()
    @IsOptional()
    name:string;

    @IsString()
    @IsOptional()
    code:string;
}